<layout name="layout" />
<link href="__PUBLIC__/umeditor1_2_2-utf8-php/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="__PUBLIC__/umeditor1_2_2-utf8-php/third-party/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/umeditor1_2_2-utf8-php/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/umeditor1_2_2-utf8-php/umeditor.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/umeditor1_2_2-utf8-php/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript">
		function addNewExtCat(btn){
			var newSel = $(btn).next("select").clone();
			$(btn).parent().append(newSel);
		}
	</script>
<div class="main-div">
    <form method="post" action="{:U('edit')}"enctype="multipart/form-data" >
        <input type="hidden" name="id" value="{:I('get.id')}" />
        <table cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="label">主分类</td>
                <td>
                	<select name="cat_id">
                		<option value="0">请选择分类</option>
                		<foreach name="catData" item="v">
                			<option value="{$v.id}" <if condition="$info['cat_id'] eq $v['id']">selected="selected"</if>>
                				<php>echo str_repeat('-',$v['level']*8);</php>{$v.cat_name}
                			</option>
                		</foreach>
                	</select>
                    <span class="require-field">*</span>
                </td>
            </tr>
            <tr>
                <td class="label">扩展分类</td>
                <td>
                	<input onclick="addNewExtCat(this);" type="button" value="添加一个扩展分类" />
                	<php>if($ecatId):</php>
	                	<foreach name="ecatId" item="ev">
		                	<select name="ext_cat_id[]">
		                		<option value="0">请选择分类</option>
		                		<foreach name="catData" item="v">
		                			<option value="{$v.id}" <if condition="$ev['cat_id'] eq $v['id']">selected="selected"</if>>
		                				<php>echo str_repeat('-',$v['level']*8);</php>{$v.cat_name}
		                			</option>
		                		</foreach>
		                	</select>
	                	</foreach>
	                <php>else :</php>
	                	<select name="ext_cat_id[]">
	                		<option value="0">请选择分类</option>
	                		<foreach name="catData" item="v">
	                			<option value="{$v.id}" <if condition="$ev['cat_id'] eq $v['id']">selected="selected"</if>>
	                				<php>echo str_repeat('-',$v['level']*8);</php>{$v.cat_name}
	                			</option>
	                		</foreach>
	                	</select>
	                <php>endif</php>
                </td>
            </tr>
            <tr>
                <td class="label">商品名称</td>
                <td>
                    <input type="text" name="goods_name" size="60" maxlength="60" value="{$info.goods_name}" />
                    <span class="require-field">*</span>
                </td>
            </tr>
            <tr>
                <td class="label">市场价格</td>
                <td>
                    <input type="text" name="market_price" value="{$info.market_price}"/>
                    <span class="require-field">*</span>
                </td>
            </tr>
            <tr>
                <td class="label">本店价格</td>
                <td>
                    <input type="text" name="shop_price" value="{$info.shop_price}"/>
                    <span class="require-field">*</span>
                </td>
            </tr>
            <tr>
                <td class="label">商品LOGO</td>
                <td>
                    <input type="file" name="logo"/>
                    <img src="{:C('IMG_ROOT')}{$info.sm_logo}" />
                </td>
            </tr>
            <tr>
                <td class="label">商品描述</td>
                <td>
                    <textarea id="goods_desc"  name="goods_desc" cols="60" rows="4"  >{$info.goods_desc}</textarea>
                </td>
            </tr>
            <tr>
                <td class="label">是否显示</td>
                <td>
                    <input type="radio" name="is_on_sale" value="是" <if condition="$info.is_on_sale eq '是'">checked="checked"</if> /> 是
                    <input type="radio" name="is_on_sale" value="否"  <if condition="$info.is_on_sale eq '否'">checked="checked"</if>/> 否
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center"><br />
                    <input type="submit" class="button" value=" 确定 " />
                    <input type="reset" class="button" value=" 重置 " />
                </td>
            </tr>
        </table>
    </form>
</div>

<script>
UM.getEditor('goods_desc',{
	initialFrameWidth:800		
});

</script>